
 begintownscript;

 variables;

 int i,j,k,r1,choice;

 body;

 beginstate INIT_STATE;
	set_name(6,"Ugmak");

	set_level(9,25);

	add_char_to_group(7,1);
	add_char_to_group(8,1);
	add_char_to_group(9,1);
	add_char_to_group(10,1);
	add_char_to_group(11,1);

	if (get_flag(13,10) > 0)
		erase_char(12);

break;

 beginstate START_STATE;
	if (get_flag(3,5) == 0) {
		message_dialog("The deeper you descended the stuffier the air got. It doesn't smell like a regular goblin cave, it smells faintly of sulfur. Something strange is going on here.","");
		set_flag(3,5,1);
}

break;

 beginstate EXIT_STATE;

break;

 beginstate 10;
	move_to_new_town(3,25,24);
break;

 beginstate 11;
	if (get_flag(3,5) == 0) {
		message_dialog("The deeper you descended the stuffier the air got. It doesn't smell like a regular goblin cave, it smells faintly of sulfur. Something strange is going on here.","");
		set_flag(3,5,1);
}
break;

 beginstate 12;
	if (get_flag(3,6) == 0) {
		message_dialog("Suddenly you hear loud chanting coming from the cavern ahead. By the sound of it there are, at least, half a dozen goblins there. The chanting is totally incomprehensible. You might have stumbled upon some kind of religious ceremony.","The smell of sulfur gets stronger");
		set_flag(3,6,1);
}
break;

 beginstate 13;
	if (get_flag(3,7) == 0) {
		reset_dialog();
		add_dialog_str(0,"A strange sight opens up in front of you. Three goblin shamans are dancing around an altar, reeking of dark energy. A tall and slightly more muscular goblin has kneeled at the altar. There is a great sword standing beside him.",0);
		add_dialog_str(1,"Just as you are about to charge them a bright glow emits from the altar. It twirls around the dancing shamans and rapidly hits the kneeled goblin. After a series of twitches the goblin begins to glow.",0);
		add_dialog_str(2,"The goblin quickly launches to his feet, grabs the great sword and points it at you. He barks orders to his comrades: _Musturs kommand ta slay humunz!_ And with a crazed roar, he attacks you.",0);
		add_dialog_str(3,"The air reeks of sulfur.",0);
		add_dialog_choice(0,"OK.");
		run_dialog(1);
		erase_char(12);
		relocate_character(6,16,23);
		set_flag(3,7,1);
}
break;

 beginstate 14;
	if (get_flag(3,8) == 0) {
		message_dialog("The goblins have caused much trouble to Faerengrove. They have looted many caravans and the chief of this tribe has brought his own personal trophies here for safekeeping.","");
		set_flag(3,8,1);
}
break;

 beginstate 15;
	message_dialog("The altar is dead. There is no magic emitting from it, although just a minute ago you saw it charge the goblin chief. You felt the power pouring from it, but now the altar is just a slab of stone. Very odd.","");
break;

 beginstate 16;
	if (get_flag(3,9) == 0) {
		reset_dialog();
		add_dialog_str(0,"You open the lid, it's not that much of a shock what's in the box: bones and skulls, mostly human, trophies a goblin would appreciate. One thing peaks your interest, though. A very impressive looking helmet is lying beneath all the bones.",0);
		add_dialog_str(1,"You take the helmet but notice one thing about it, the owner's head is still in there. It's still reasonably fresh, you could scoop the head out and take the helmet.",0);
		add_dialog_choice(0,"Dig the head out.");
		add_dialog_choice(1,"Leave the helmet.");
		choice = run_dialog(1);
	if (choice == 1) {
		message_dialog("You stick your hand in and pull out the head. A little washing and this helmet would be just fine.","");
		reward_give(449);
		set_flag(3,9,1);
}
	if (choice == 2)
		end();
}
break;
		